package com.example.contentprovidermodule

import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
import android.util.Log


class DBHelper(context: Context):SQLiteOpenHelper(context,"myprovider",null,1) {
    private  val TAG = "DBHelper"
    private val createMyProvider="create table myprovider (" +
            "id integer primary key autoincrement," +
            "name varchar)"

    /**
     * 建表
     */
    override fun onCreate(db: SQLiteDatabase?) {
        Log.d(TAG, "开始建表")
//        TODO("Not yet implemented")
        db?.execSQL(this.createMyProvider)
        db?.execSQL("insert into myprovider values(null,'Tom')")
    }

    override fun onUpgrade(db: SQLiteDatabase?, oldVersion: Int, newVersion: Int) {
        TODO("Not yet implemented")
    }
}